package ai.plantdata.constant;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
public enum DbTypeEnum {
    MYSQL("MYSQL"),
    ORACLE("ORACLE");

    private final String type;


    public static DbTypeEnum from(String val) {
        if (val == null || val.length() == 0) {
            return null;
        }

        return Arrays.stream(DbTypeEnum.values())
                .filter(a -> a.type.equals(val))
                .findFirst()
                .orElse(null);
    }
}
